<!DOCTYPE html>
<html>
<head>
	<title>@yield('title')</title>
    <meta name="keywords" content="翻倍花，O2O，第三方推广，服务平台">
    <meta name="description" content="翻贝网致力于打造国内最具公信力的第三方推广和服务平台">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut  icon" type="image/x-icon" href="{{ env('IMAGE_DOMAIN') }}images/icon.png" media="screen"  />
@section('resources')
    <!-- bootstrap -->
    <link href="{{env('CSS_DOMAIN')}}css/bootstrap/bootstrap.css?version={{env('CSS_VERSION')}}" rel="stylesheet" />
    <link href="{{env('CSS_DOMAIN')}}css/bootstrap/bootstrap-overrides.css?version={{env('CSS_VERSION')}}" type="text/css" rel="stylesheet" />
    <!-- libraries -->
    <link href="{{env('CSS_DOMAIN')}}css/lib/jquery-ui-1.10.2.custom.css?version={{env('CSS_VERSION')}}" rel="stylesheet" type="text/css" />
    <link href="{{env('CSS_DOMAIN')}}css/lib/font-awesome.css?version={{env('CSS_VERSION')}}" type="text/css" rel="stylesheet" />
    <!-- global styles -->
    <link href="{{env('CSS_DOMAIN')}}css/compiled/layout.css?version={{env('CSS_VERSION')}}" rel="stylesheet" type="text/css" >
    <link href="{{env('CSS_DOMAIN')}}css/compiled/elements.css?version={{env('CSS_VERSION')}}" rel="stylesheet" type="text/css">
    <link href="{{env('CSS_DOMAIN')}}css/compiled/icons.css?version={{env('CSS_VERSION')}}" rel="stylesheet" type="text/css" >
    <!-- this page specific styles -->
    <link href="{{env('CSS_DOMAIN')}}css/compiled/index.css?version={{env('CSS_VERSION')}}" rel="stylesheet" type="text/css" media="screen" />
    <!-- open sans font -->
    {{--<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>--}}
    <!-- lato font -->
    {{--<link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,900,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>--}}
    <link href="{{env('CSS_DOMAIN')}}css/shop.css?version={{env('CSS_VERSION')}}" rel="stylesheet" type="text/css" >
@show
    <style>
        .promit_mark{width: 100%;position: fixed;top: 0;left: 0;z-index: 1000;display: none;height: 100%;}
        .shop_App{cursor: pointer;position: relative;height: 50px;}
        .shop_App p{position: absolute;top: 50px;left: -60px;background: #fff;border: 1px solid #000;padding: 20px;display: none;}
        .user_message{display: none;}
        @media (max-width: 768px) {
            .user_message {
                display: block !important;
            }
        }
        @media (min-width: 768px){
            .navbar{position: fixed;top: 0;left: 0;width: 100%;}
            #sidebar-nav{position: fixed;top: 0;left: 0;}
            .content{margin-top: 52px;}
        }
        .submenu li a{margin-left: 35px;}
        #sidebar-nav #dashboard-menu .dashboard_menu span{font-size: 14px;}
        .down_down{position: relative;float: right;top: 5px;}
        .prompt{width: 300px;position: fixed;top: 200px;left: 50%;margin-left: -150px;box-shadow: 0px 0px 5px 5px rgba(128,128,128,0.5);background-color: #fff;display: none;z-index: 1001;}
        .prompt .title{overflow: hidden;width: 100%;height: 50px;line-height: 50px;}
        .prompt .title span{float: left;font-size: 16px;color: #808080;margin-left: 15px;}
        .prompt .title img{float: right;width: 20px;margin-top: 15px;margin-right: 15px;cursor: pointer;}
        .prompt .prompt_content{padding: 15px 30px;font-size: 14px;}
        .prompt .button span{padding: 15px 0;font-size: 16px;cursor: pointer;width: 100%;text-align: center;}
    </style>
</head>
<body>
    <!-- navbar -->
    <p class="promit_mark"></p>
    <header class="navbar navbar-inverse" role="banner">
        <div class="navbar-header">
            <button class="navbar-toggle" type="button" data-toggle="collapse" id="menu-toggler">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <div class="navbar-brand">
                <img src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/left_icon.png">
                <select name="" id="choose_shop" onchange="select_shop_ids()">
                    
                </select>
            </div>
        </div>
        <ul class="nav navbar-nav pull-right hidden-xs">
            <li class="navbar-brand">
                客服热线：400-6989-820
            </li>
            <li class="navbar-brand shop_App">
                商家版App
                <p>
                    <img style="width: 210px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/shop_App.png" alt="">
                    <span style="color: #000;font-size: 14px;">手机扫一扫下载翻贝网商家版App</span>
                </p>
            </li>
            <li class="dropdown">
                <a href="#" class="dropdown-toggle hidden-xs hidden-sm" data-toggle="dropdown" style="color: #fff;font-size: 18px;">
                    <span class="shopusername"></span>
                    <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="/shop/user/message">账户资料</a></li>
                    <li><a href="/shop/logout">退出</a></li>
                </ul>
            </li>
        </ul>
    </header>
    <!-- end navbar -->
    <!-- sidebar -->
    <div id="sidebar-nav">
        <ul id="dashboard-menu">
            <li class="dashboard_menu">
                <a href="/shop/index">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/index.png" alt=""></i>
                    <span>首页</span>
                </a>
            </li>
            <!-- <li class="dashboard_menu">
                <a href="/shop/index/more">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/index.png" alt=""></i>
                    <span>首页</span>
                </a>
            </li> -->
            <li class="dashboard_menu">
                <a href="/shop/order/index">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/order.png" alt=""></i>
                    <span>订单管理</span>
                </a>
            </li>
            <li class="dashboard_menu">
                <a class="dropdown-toggle" href="#">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/salesman.png" alt=""></i>
                    <span>地推管理</span>
                    <img class="down_down" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/down_down.png" alt="">
                </a>
                <ul class="submenu">
                    <li><a href="/shop/salesman/register/user/index">注册用户</a></li>
                    <li><a href="/shop/salesman/salesman/order/index">地推订单</a></li>
                </ul>
            </li>
            <li class="dashboard_menu">
                <a class="dropdown-toggle" href="#">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/finance.png" alt=""></i>
                    <span>财务结款</span>
                    <img class="down_down" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/down_down.png" alt="">
                </a>
                <ul class="submenu">
                    <li><a href="/shop/finance/for/payment/order/index">订单结款</a></li>
                    <li><a href="/shop/finance/for/payment/salesman/index">地推结款</a></li>
                </ul>
            </li>
            <li class="dashboard_menu">
                <a href="/shop/qrcode/shop/qrcode">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/eweima.png" alt=""></i>
                    <span>专属二维码</span>
                </a>
            </li>
            <li class="dashboard_menu" id="admin" hidden>
                <a class="dropdown-toggle" href="#">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/common.png" alt=""></i>
                    <span>授权管理</span>
                    <img class="down_down" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/down_down.png" alt="">
                </a>
                <ul class="submenu">
                    <li><a href="/shop/admin/account/add" target="_blank">创建子账号</a></li>
                    <li class="children_list"><a href="#">子账号列表</a></li>
                </ul>
            </li>
            <li class="dashboard_menu user_message">
                <a href="/shop/user/message">
                    <i><img style="width: 20px;" src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/shop_message.png" alt=""></i>
                    <span>账户资料</span>
                </a>
            </li>
        </ul>
    </div>
    <div class="prompt">
        <p class="title">
            <span>确认提示</span>
            <img src="{{env('IMAGE_DOMAIN')}}images/close_p.png" alt="">
        </p>
        <p class="prompt_content"></p>
        <p class="button">
            <span class="sure" style="float: right;">确定</span>
        </p>
    </div>
    <!-- end sidebar -->

    @yield('content')
	<!-- main container -->
    {{--<div class="content">--}}

    {{--</div>--}}
 @section('scriptResources')
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js?version={{env('JS_VERSION')}}"></script>
    <![endif]-->
    {{--<script src="http://code.jquery.com/jquery-latest.js?version={{env('JS_VERSION')}}"></script>--}}
    <script src="{{env('JS_DOMAIN')}}js/jquery-1.11.1.min.js?v={{env('JS_VERSION')}}"></script>
    <script src="{{env('JS_DOMAIN')}}js/jquery.dataTables.min.js?v={{env('JS_VERSION')}}"></script>
    <script src="{{env('JS_DOMAIN')}}js/bootstrap.min.js?version={{env('JS_VERSION')}}"></script>
    <script src="{{env('JS_DOMAIN')}}js/jquery-ui-1.10.2.custom.min.js?version={{env('JS_VERSION')}}"></script>
    <!-- knob -->
    <script src="{{env('JS_DOMAIN')}}js/jquery.knob.js?version={{env('JS_VERSION')}}"></script>
    <!-- flot charts -->
    <script src="{{env('JS_DOMAIN')}}js/jquery.flot.js?version={{env('JS_VERSION')}}"></script>
    {{--<script src="{{env('JS_DOMAIN')}}js/jquery.flot.stack.js?version={{env('JS_VERSION')}}"></script>--}}
    {{--<script src="{{env('JS_DOMAIN')}}js/jquery.flot.resize.js?version={{env('JS_VERSION')}}"></script>--}}
    <script src="{{env('JS_DOMAIN')}}js/theme.js?version={{env('JS_VERSION')}}"></script>
@show
    <script>
        var locationUrl = window.location.pathname;
        var icon=$('<div class="pointer"><div class="arrow"></div><div class="arrow_border"></div></div>');
        //显示页面的图标跟踪
        if(locationUrl.indexOf('shop/index')>=0){
            $("#dashboard-menu .dashboard_menu").eq(0).addClass('active');
            $("#dashboard-menu .dashboard_menu").eq(0).append(icon);
        }else if(locationUrl.indexOf('shop/order')>=0){
            $("#dashboard-menu .dashboard_menu").eq(1).addClass('active');
            $("#dashboard-menu .dashboard_menu").eq(1).append(icon);
        }else if(locationUrl.indexOf('shop/salesman')>=0){
            $("#dashboard-menu .dashboard_menu").eq(2).addClass('active');
            $("#dashboard-menu .dashboard_menu").eq(2).append(icon);
            $("#dashboard-menu .dashboard_menu").eq(2).children('.submenu').show();
        }else if(locationUrl.indexOf('shop/finance')>=0){
            $("#dashboard-menu .dashboard_menu").eq(3).addClass('active');
            $("#dashboard-menu .dashboard_menu").eq(3).append(icon);
            $("#dashboard-menu .dashboard_menu").eq(3).children('.submenu').show();
        }else if(locationUrl.indexOf('shop/qrcode')>=0){
            $("#dashboard-menu .dashboard_menu").eq(4).addClass('active');
            $("#dashboard-menu .dashboard_menu").eq(4).append(icon);
        }else if(locationUrl.indexOf('shop/admin')>=0){
            $("#dashboard-menu .dashboard_menu").eq(5).addClass('active');
            $("#dashboard-menu .dashboard_menu").eq(5).append(icon);
            $("#dashboard-menu .dashboard_menu").eq(5).children('.submenu').show();
        }
        //商家版App下载二维码显示
        $(".shop_App").mouseover(function(){
            $(".shop_App p").show();
        })
        $(".shop_App").mouseout(function(){
            $(".shop_App p").hide();
        })
        var selected_shop_name = "";
        $.ajax({
            url: '/shop/all/getbyuserid',
            type: 'get',
            data:'',
            dataType:'json',
            async:false,
            success:function(data){
                if(data.status == "success"){
                    var data = data.data;
                    var lists = data.lists;
                    var select_shop_id = data.selectshopid;
                    var select_shop_name = data.selectshopname;
                    var shop_user_name = data.shopusername;
                    $(".shopusername").html(shop_user_name);
                    for (var i = 0; i < lists.length; i++) {
                        if(lists[i].shopid == select_shop_id) {
                            var option = $('<option value="'+lists[i].shopid+'" selected>'+lists[i].shopname+'</option>');
                        } else {
                            var option = $('<option value="'+lists[i].shopid+'">'+lists[i].shopname+'</option>');
                        }
                        $("#choose_shop").append(option);
                    };
                    selected_shop_name = $("#choose_shop").find("option:selected").html();
                }else{
                    alert(data.message)
                }
            }
        });
        $.ajax({
            url: '/shop/admin/auth/createorlist',
            type: 'get',
            data:'',
            dataType:'json',
            async:false,
            success:function(data){
                if(data.status == "success"){
                    var data = data.data;
                    if(data.iscreatesubaccountauth == 1){
                        $("#admin").show();
                        $(".children_list").click(function(){
                            if(selected_shop_name == "全部"){
                                $('.prompt').show();
                                $('.promit_mark').show();
                                $('.prompt .prompt_content').html('请选择单一门店');return false;
                            }else if(data.islistauth == 0){
                                $('.prompt').show();
                                $('.promit_mark').show();
                                $('.prompt .prompt_content').html('你不是该店的管理员');return false;
                            }else{
                                location.href = '/shop/admin/list';
                            }
                        })
                    }else{
                        $("#admin").hide();
                    };
                }else{
                    alert(data.message)
                }
            }
        });
        function select_shop_ids() {
            var selected_shop_ids = $("#choose_shop").find("option:selected").val();
            var selected_shop_name = $("#choose_shop").find("option:selected").html();
            window.location.href = "/shop/index?shopids="+selected_shop_ids+"&shopname="+selected_shop_name;
        }
        // $(".children_list").click(function(){
        //     if(selected_shop_name == "全部"){
        //         alert("请选择单一门店");return false;
        //     }else{
        //         location.href = '/shop/admin/list';
        //     }
        // })
        $(".prompt .sure").click(function(){
           $(".prompt").hide();
           $(".promit_mark").hide();
        })
        $(".prompt .title img").click(function(){
           $(".prompt").hide();
           $(".promit_mark").hide();
        })
    </script>
</body>
</html>